/*
 *  levelUpGame - InputController.h
 *  Copyright 2011 W. Reckman. All rights reserved.
 */
#ifndef INPUT_CONTROLLER_H
#define INPUT_CONTROLLER_H

#include <vector>
#include "Settings.h"
#include "SerialDevice.h"

class InputController {
public:
	ofEvent<EventArgsJoystick> onPlayerInput;
	
	InputController();
	
	void setup();
	void update();
	
	//void setEmulationForPlayer( int playerId, bool enableEmulation );
	//void bindKeysForPlayer( int playerId, int keyUp, int keyDown, int keyLeft, int keyRight );
	
	void keyPressed( int key );
	
private:
	struct PlayerBindings {
		bool emulationEnabled;
		int keyUp;
		int keyDown;
		int keyLeft;
		int keyRight;
		int keyStop;
	};
	
	typedef std::vector<PlayerBindings> vec_PlayerBindings;
	
	
	const Settings& s;
	SerialDevice serialJoystick;
	
	bool serialEnabled;
	
	vec_PlayerBindings playerBindings;
	
	int	deviceId;
	int baudRate;
	
	void onJoystickMoved( EventArgsJoystick& ev_ );
};

#endif /* ! INPUT_CONTROLLER_H */
